new Vue({
	el: '#app',
	data: {
		realname: '',
		cardId: '',
		phone: '',
		sex: '',
		mealId: '',
		meal_list: [],

	},
	mounted() {
		showHead();
		showLeftMenu();
		this.getMealList();
	},
	methods: {
		addOrder() {
			var _this = this;

			$.ajax("Order/addOrder", {
				type: "POST",
				data: {
					realname: _this.realname,
					cardId: _this.cardId,
					mealId: _this.mealId,
					phone: _this.phone,
					sex: _this.sex,
				},
				success: function(data, textStatus) {
					let datas = JSON.parse(data);
					if (datas.statusCode == 200) {
						alert(datas.errMsg);
						location.href = "href?to=meal_list&card_id="+ _this.cardId;
					} else {
						alert(datas.errMsg)
					}
				}
			})
		},
		getMealList() {

			var _this = this;
		
			$.ajax("Meal/getMealList", {
				type: "POST",
				success: function(data, textStatus) {
					console.log(data)
					let datas = JSON.parse(data);
					console.log(datas)
					if (datas.statusCode == 200) {
						_this.meal_list = datas.datas.list;
					} else {
						alert(datas.errMsg);
					}
				}
			})
		}

	}
})